﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using StackExchange.Redis;
using SqlSugar;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using NLog;
using NLog.Web;
using chihuopig.Web.Framework;
using chihuopig.IService;
using chihuopig.Tool;

namespace chihuopig.Web.Admin.Controllers
{
    public class AdminController : AdminWattantyController
    {
     
        private IDatabase _IDatabase;
        IHttpContextAccessor _iHttpContextAccessor;
        IAdminMenuService _iadminMenuService;
        public AdminController(IDatabase Database, 
            IHttpContextAccessor iHttpContextAccessor,
            IAdminMenuService iadminMenuService
            ) :base(iHttpContextAccessor) 
        {
            _IDatabase = Database;
            _iHttpContextAccessor = iHttpContextAccessor;
            _iadminMenuService = iadminMenuService;
        }/**/

        public async Task<IActionResult> Index()
        {
            var menList=await _iadminMenuService.GetadminMenuById(admin.Id);
            ViewBag.TestitleName = admin.Name;
            //_IDatabase.StringSet("fdsf", "123456");
            return View(menList);
        }

        public IActionResult logingout()
        {
            UtilityHelper.DeleteCookie(CookieKeysCollection.Buffalo_Admin);
            return Redirect("/admin/admin/index");
        }

        public IActionResult welcome()
        {
            return View();
        }
    }
}